const http = require('node:http');
const fs = require('node:fs');
const server = http.createServer()

server.listen(8080,()=>{
    console.log('启动了8080')
})


server.on('request',(req,res)=>{
    console.log('666',req.url)
    res.setHeader('Content-type','text/html;charset=utf-8')
    // res.write('响应了')
    fs.readFile('./index.html','utf-8',(err,data)=>{
        res.write(data);
        res.end();
    })
    fs.readFile('./image.png',(err,data)=>{
        res.end(data);
    })
  
})